package com.cm.study.other.design.patterns.proxy;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
public class ProxyMain {
    public static void main(String[] args) throws Exception {
        IService service = new IServiceImpl();
        System.getProperties().put("sun.misc.ProxyGenerator.saveGeneratedFiles","true");
        InvocationHandler handler = new IServiceProxy(service);
        Class<?>[] interfaces = service.getClass().getInterfaces();
        IService proxyService = (IService) Proxy.newProxyInstance(IService.class.getClassLoader(),interfaces, handler);
        //proxyService.doService();
    }
}
